<%--
  Created by IntelliJ IDEA.
  User: CDLX
  Date: 2021/11/25
  Time: 下午 03:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layuicms2.0/layui/css/layui.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layuicms2.0/layui_ext/dtree/dtree.css">
    <link rel="stylesheet"
          href="${pageContext.request.contextPath}/static/layuicms2.0/layui_ext/dtree/font/dtreefont.css">
</head>
<body>
<ul id="demoTree" class="dtree" data-id="0"></ul>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/layuicms2.0/layui/layui.js"></script>

<script>

    var demoTree
    layui.extend({
        dtree: '${pageContext.request.contextPath}/static/layuicms2.0/layui_ext/dtree/dtree'   // {/}的意思即代表采用自有路径，即不跟随 base 路径
    }).use(['dtree', 'layer', 'jquery'], function () {
        var dtree = layui.dtree, layer = layui.layer, $ = layui.jquery;
        // 初始化树
        demoTree = dtree.render({
            elem: "#demoTree",
            url: "/car/menu/leftMenu" // 使用url加载（可与data加载同时存在）
            , dataStyle: "layuiStyle",  //使用layui风格的数据格式
            response: {message: "msg", statusCode: 0}  //修改response中返回数据的定义
        });
        // 绑定节点点击
        dtree.on("node('demoTree')", function (obj) {
            window.parent.right.searchById(obj.param.nodeId)
            // layer.msg(JSON.stringify());
        });
    });
</script>
</body>
</html>